--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 1bef747306ad0100455f8a4fc749c6cd61dd1781
Parents : d6ec051
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Date : 2026-05-20T19:55:03+02:00
Cleanup
Changes
Diff
diff --git a/LXMF/LXMessage.py b/LXMF/LXMessage.py
index 639ab36..fdc0be8 100644
--- a/LXMF/LXMessage.py
+++ b/LXMF/LXMessage.py
@@ -668,7 +668,6 @@ class LXMessage:
return msgpack.packb(container)
-
def write_to_directory(self, directory_path):
file_name = RNS.hexrep(self.hash, delimit=False)
file_path = directory_path+"/"+file_name
@@ -678,20 +677,17 @@ class LXMessage:
with open(tmp_path, "wb") as file:
file.write(self.packed_container())
file.flush()
- try:
- os.fsync(file.fileno())
- except OSError:
- pass
- os.replace(tmp_path, file_path)
+ try: os.fsync(file.fileno())
+ except OSError: pass
+ os.replace(tmp_path, file_path)
return file_path
except Exception as e:
try:
- if os.path.exists(tmp_path):
- os.unlink(tmp_path)
- except Exception:
- pass
+ if os.path.exists(tmp_path): os.unlink(tmp_path)
+ except Exception: pass
+
RNS.log("Error while writing LXMF message to file \""+str(file_path)+"\". The contained exception was: "+str(e), RNS.LOG_ERROR)
return None
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────